<%-- <%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> --%>

<!DOCTYPE HTML>
<html>
  <head>
<%--     <base href="<%=basePath%>"> --%>
    
    <title>VoteResult--</title>
    
    <meta charset="utf8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script src="js/echarts.js"></script>
  </head>
  
  <body>
  <%@ include file="heading.jsp" %>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
    	//organize the resource
    	var result = <%=request.getAttribute("result") %>;
    	/* result = JSON.parse(result); */
    	var vote = result.vote, options = result.options, xAxis=[], series=[];
    	document.title += vote.voteName;
    	for(var i in options){
    		xAxis.push( options[i].optionName );
    		series.push( options[i].ticketNum );
    	}
    	
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
        var param = {
            title: {
                text: vote.voteName,
            },
            tooltip: {},
            legend: {
                data:[vote.voteName]
            },
            xAxis: {
               /*  data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] */
               data: xAxis,
            },
            yAxis: {},
            series: [{
            	name : vote.voteName,
                /* name: '销量', */
                type: 'bar',
                /* data: [5, 20, 36, 10, 10, 20], */
                data: series,
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(param);
    </script>
  </body>
</html>
